//
//  NSDictionary+Log.m
//  多值参数
//
//  Created by 杨庆 on 2016/12/20.
//  Copyright © 2016年 杨庆. All rights reserved.
//

#import <Foundation/Foundation.h>
@implementation NSDictionary (Log)
-(NSString*)descriptionWithLocale:(id)locale{
	NSMutableString*string=[NSMutableString string];
	//开头有个{
	[string appendString:@"{\n"];
	[self enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
		[string appendFormat:@"\t%@",key];
		[string appendString:@":"];
		[string appendFormat:@"%@,\n",obj];
	}];
	//结尾有个}
	[string appendString:@"}"];
	
	//查找最后一个逗号
	
	NSRange range=[string rangeOfString:@"," options:NSBackwardsSearch];
	if (range.location !=NSNotFound) {
			[string deleteCharactersInRange:range];
	}

	
	return string;
	
}


@end
@implementation NSArray (Log)
-(NSString*)descriptionWithLocale:(id)locale{

	NSMutableString*string=[NSMutableString string];
	
	//开头有个[
	[string appendString:@"[\n"];
	
	[self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
		[string appendFormat:@"\t%@\n",obj];
	}];
	
	//结尾有个]
	[string appendString:@"]"];
	
	NSRange range=[string rangeOfString:@"," options:NSBackwardsSearch];
	if (range.location !=NSNotFound) {
		[string deleteCharactersInRange:range];
	}
	
	return string;
}
@end
